package com.zsc.wxapp.controller.common;

import com.zsc.wxapp.entity.vo.PriceTimeVO;
import com.zsc.wxapp.result.Result;
import com.zsc.wxapp.entity.vo.BrandFluctuateNumVO;
import com.zsc.wxapp.services.PriceTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RequestMapping("/api/wxapp/common/priceTime")
@RestController("commonPriceTimeController")
//@Api(tags = "公共类-每日价格相关接口")
@Slf4j
public class PriceTimeController {

    @Resource
    private PriceTimeService priceTimeService;

    /**
     * 比较价格浮动品牌数量
     * @return Result
     */
    @GetMapping("/comparePriceNum")
//    @ApiOperation("比较价格浮动品牌数量")
    public Result<BrandFluctuateNumVO> comparePricesNum() {
        log.info("比较价格浮动品牌数量");
        BrandFluctuateNumVO brandFluctuateNumVO = priceTimeService.comparePricesNum();
        return Result.success(brandFluctuateNumVO);
    }

    /**
     * 获取近日的价格情况
     * @param id 卷烟id
     * @return List
     */
    @GetMapping("/getPriceTimeList")
//    @ApiOperation("获取近日市场均价")
//    @ApiImplicitParam(name = "id", value = "价格id", required = true, dataTypeClass = String.class)
    public Result<List<PriceTimeVO>> getPriceTimeList(Integer id) {
        log.info("获取卷烟价格列表");
        List<PriceTimeVO> priceTimeVOList = priceTimeService.getPriceTimeList(id);
        return Result.success(priceTimeVOList);
    }

    @GetMapping("/getFactory")
    public Result<List<String>> getFactory() {
        log.info("获取卷烟厂家");
        String[] factory = {"上海烟草公司", "河北中烟", "江苏中烟", "浙江中烟", "安徽中烟", "福建中烟", "山东中烟",
                "河南中烟", "湖北中烟", "湖南中烟", "广东中烟", "广西中烟", "川渝中烟", "贵州中烟", "云南中烟", "红云红河烟草(集团)",
                "齢翹适邻№铵婻弄咚中兄弟烟草股份", "利是美股份有限公司", "日烟国际(集团)", "英飞烽香港有限公司", "凯德控股有限公司", "新加坡英美烟草公司",
                "澳门云福卷烟厂", "台湾家源开发股份", "四川中烟", "重庆中烟", "黑龙江工业", "厦门调拨站", "江西中烟",
                "深圳工业", "红塔烟草(集团)公司", "陕西中烟", "三宝麟国际集团", "耀莱雪茄控股有限公司", "红塔辽宁烟草", "日本烟草(香港)有限公司",
                "英美烟草中国有限公司", "万士丰", "内蒙古昆明卷烟", "上海烟草(集团)公司", "渎慌羝价京三五", "博格集团", "雪茄客烟草国际贸易有限公司",
                "内蒙古昆明卷烟", "博格集团", "山西昆明烟草", "红塔辽宁烟草", "特富意烟草(国际)", "鱭炑闀辩滀近量雪茄烟草有限公司", "韩国烟草人参公司", "引领国际有限公司",
                "河南中烟", "四川烟草", "菲利普莫里斯亚洲", "吉林工业", "甘肃工业", "中茄国际贸易有限公司", "嘉莱赫国际有限公司", "韩国烟草人参公司", "株式会社 KT&G",
                "北欧烟草集团", "中国烟草国际", "吉林工业", "中烟英美烟草国际有限公司", "海南红塔"};
        List<String> result = new ArrayList<>(Arrays.asList(factory));
        return Result.success(result);
    }

}
